<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <style>
    * {
      margin: 0;
      padding: 0;
    }
    .aa {
      height: 400px;
      border: 1px solid #000;
      overflow: auto;
    }
    .bb {
      height: 1000px;
    }
    .cc {
      background: #00ffff;
    }
    .dd {
      background: #cccccc;
    }
  </style>
  <body>
    <div class="aa">
      <div class="bb">
        <div class="cc"></div>
        <div class="dd"></div>
      </div>
    </div>
  </body>
  <script type="text/javascript">
    document.querySelector('.aa').onscroll = function(y) {
      console.log(this.scrollTop);
      document.querySelector('.cc').style.height = this.scrollTop + 'px';
    };
  </script>
</html>
